package com.minhua.jijiehao2.mainframe.home.homeFragment.impl

import com.minhua.jijiehao2.base.BaseMvpPresenter
import com.minhua.jijiehao2.bean.BaseBean
import com.minhua.jijiehao2.bean.ChannelBean
import com.minhua.jijiehao2.bean.HomeBannerBean
import com.minhua.jijiehao2.bean.HomeMenuBean
import com.minhua.jijiehao2.http.CallBack
import com.minhua.jijiehao2.http.ParamsMap
import com.minhua.jijiehao2.mainframe.home.homeFragment.imp.IHomePresenter
import com.minhua.jijiehao2.mainframe.home.homeFragment.imp.IHomeView

class HomePresenter : BaseMvpPresenter<IHomeView>(), IHomePresenter {
    private var mHomeModel = HomeModel()

    override fun getBannerInfo() {
        val map = ParamsMap()
        mHomeModel.getBannerInfo(map, object : CallBack<HomeBannerBean>() {
            override fun onSuccess(t: BaseBean<HomeBannerBean>) {
                v?.onBannerSuccess(t.data!!)
            }
        })
    }

    override fun getHotInfo() {
        val map = ParamsMap()
        mHomeModel.getHotInfo(map, object : CallBack<List<ChannelBean>>() {
            override fun onSuccess(t: BaseBean<List<ChannelBean>>) {
                v?.onHotChannelSuccess(t.data!!)
            }
        })
    }

    override fun getMenuInfo() {
        val map = ParamsMap()
        mHomeModel.getMenuInfo(map, object : CallBack<List<HomeMenuBean>>() {
            override fun onSuccess(t: BaseBean<List<HomeMenuBean>>) {
                v?.onMenuSuccess(t.data!!)
            }
        })
    }
}